package com.android.danaobank.mvp.presenter;

import com.android.danaobank.api.ApiClient;
import com.android.danaobank.model.HttpResponse;
import com.android.danaobank.model.response.Advertisement;
import com.android.danaobank.mvp.view.GetAdvertisementView;
import com.lg.meng.base.BasePresenter;

import java.util.List;

public class GetAdvertisementPresenter extends BasePresenter<GetAdvertisementView> {
    public void getAdvertisementByType(String type) {
        ApiClient.getInstance().getAdvertisementByType(type)
                .subscribe(simpleObserver(new Callback<HttpResponse<List<Advertisement>>>() {
                    @Override
                    public void resultSuccess(HttpResponse<List<Advertisement>> data) {
                        view.getAdvertisementSuccess(data.getData());
                    }

                    @Override
                    public void resultError(Throwable e) {
                        view.getAdvertisementFailed();
                    }
                }));
    }
}
